﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package GameMode {
    import Engine.Classes.*;
    import flash.events.*;
    import flash.geom.*;
    import Mechanics.GameMechanicInterfaces.*;
    import Mechanics.*;
    import Events.*;
    import org.aswing.*;
    import Classes.*;
    import Display.*;
    import Modules.crew.*;

    public class GMPlay extends GMDefault {

        public function GMPlay(){
            m_uiMode = UIEvent.CURSOR;
        }
        override public function get supportsEditing():Boolean{
            return (false);
        }
        override protected function isObjectSelectable(_arg1:GameObject):Boolean{
            return (false);
        }
        override protected function isObjectDraggable(_arg1:GameObject):Boolean{
            return (false);
        }
        override public function onMouseDown(_arg1:MouseEvent):Boolean{
            if (!Global.franchiseManager.placementMode){
                return (super.onMouseDown(_arg1));
            };
            return (false);
        }
        override protected function handleClick(_arg1:MouseEvent):void{
            var _local3:Boolean;
            var _local4:Point;
            var _local5:Boolean;
            var _local2:GameObject = m_highlightedObject;
            if (((m_highlightedObject) && (m_highlightedObject.isAttached()))){
                _local3 = true;
                if (((m_highlightedObject) && ((m_highlightedObject is IMechanicUser)))){
                    _local3 = !(MechanicManager.getInstance().handleAction((m_highlightedObject as IMechanicUser), Global.getClassName(this)));
                };
                if ((((_local2 is IMechanicPrePlayAction)) && (!(_local3)))){
                    (_local2 as IMechanicPrePlayAction).onPrePlayTrack();
                };
                if (!_local3){
                    RollCallManager.debugSample("GMPlay", "handleClick", "deferToObject_false", _local2.getClassName());
                };
                if (((m_highlightedObject) && (_local3))){
                    RollCallManager.debugSample("GMPlay", "handleClick", "deferToObject_true", _local2.getClassName());
                    m_highlightedObject.onPlayAction();
                };
            } else {
                _local4 = getMouseTilePos(_arg1);
                _local5 = Global.world.rectInTerritory(new Rectangle((_local4.x - 1), (_local4.y - 1), 1, 1));
                if (((((((!(Global.isVisiting())) && (!(_local5)))) && ((_arg1.currentTarget is IsoViewport)))) && (!((_arg1.target is AWSprite))))){
                    UI.displayStatus(ZLoc.t("Main", "BuyExpansionFirstRed"), _arg1.stageX, _arg1.stageY);
                    Global.ui.showTickerMessage(ZLoc.t("Main", "TickerBuyExpansion"));
                } else {
                    super.handleClick(_arg1);
                };
            };
        }

    }
}//package GameMode 
